window.addEventListener('load',function(){
	var test1 = new Swiper('.swiper-test1',{
					 navigation:{
						 nextEl: '.swiper-test .swiper-button-next',
						 prevEl: '.swiper-test .swiper-button-prev',
					 },
	})
	
	// 选项卡1
	var item= document.querySelectorAll(".nav .swiper-test1  .swiper-slide");
	for(var i=0;i<item.length;i++){
		//自定义属性
		item[i].setAttribute('index',i);
		//绑定点击事件
		item[i].onclick = function(){
		// 被选中元素含有的类名
		// console.log(this.classList);
		// 获取自定义属性的值
		var index = this.getAttribute('index');
		// console.log(index); //0 1 2 
		for(var j=0;j<item.length;j++){
			//删除指定的类名
			item[j].classList.remove('active');
		}
		item[index].classList.add('active');	
		}
	}
	// 选项卡2
	var item2= document.querySelectorAll(".quanbu ul li");
	for(var i=0;i<item2.length;i++){
		item2[i].setAttribute('index',i);
		item2[i].onclick = function(){
		var index = this.getAttribute('index');
		for(var j=0;j<item2.length;j++){
			//删除指定的类名
			item2[j].classList.remove('active');
		}
		item2[index].classList.add('active');	
		}
	}
	
	// 点击事件
	var dingwei = document.querySelector(".dingwei");
	var swiper1 = document.querySelector(".swiper-test1");
	var quanbu = document.querySelector(".quanbu");
	var shang = document.querySelector(".quanbu-title i");
	var neirong =document.querySelector(".neirong");
	dingwei.onclick = function(){
		swiper1.style.display ="none";
		quanbu.style.display = "block";
	}
	shang.onclick =function(){
		swiper1.style.display = "block";
		quanbu.style.display = "none";
	}
	
	// 轮播2
	 var test2 = new Swiper('.swiper-test22',{
		 loop:true,
		 pagination:{//分页器
			 el:'.swiper-test22  .swiper-pagination',
			 // clickable:true,
		 },
	 })
	 
})